<?php
	/*
		@教学点播处理
	*/
	
	@$action = $_GET['action'];
	//处理方法
	if(empty($action) || !isset($action)){$action = "default";}

	if($action == "default"){
		
		include_once("configs/database.inc.php");		//引入数据库配置
		$D->query("set names utf8");
		if($D->rowsAll("broadcastCategory")){
			$res_broadcastCategory = $D->fetchAll("broadcastCategory");
		}else{
			$res_broadcastCategory = "NULL";	
		}
		
		$smarty->assign('res_broadcastCategory',$res_broadcastCategory);
		$smarty->assign('title','先锋视频--视频搜索');
		$smarty->display('search.tpl');
	}else if($action == "searchAction"){
		//取得数据参数
		$category = $_POST['category'];
		$keyword = $_POST['keyword'];
				
		include_once("configs/database.inc.php");		//引入数据库配置
		$res_search = $D->fetchAllQuery("SELECT * FROM `broadcast` WHERE `category` =".$category." AND `title` LIKE '%".$keyword."%'");
		
		//测试查询结果
		var_dump($res_search);
		
	}
?>